/*
import { info, warn, error, getLogger } from 'utils';
const logger = getLogger('About', '#3130f0', 'pat');
*/

function log() {
	// <remove>
	const DEFAULT = {
		BLACK: '#2f2f2f',
		RED: '#eb5d7b',
		BLUE: '#488abe',
		YELLOW: '#ddbf56',
		GREEN: '#43a754'
	};
	if (arguments.length == 1 || typeof arguments[0] !== 'string') {
		console.log.apply(console, arguments);
	} else {
		let first = arguments[0];
		let style = 'color: #f5f5f5; padding: 2px 10px; border-radius:12px; font-weight: bold;';

		const args = [];
		for (let i = 1; i < arguments.length; i++) args.push(arguments[i]);
		first = first.split('#');
		const color =
			DEFAULT[first[1]] != undefined
				? DEFAULT[first[1]]
				: '#' + (first[1] == '' ? ~~(100 + Math.random() * 899) : first[1]);
		const title = first[2] || 'Logger';
		console.log.apply(console, ['%c' + title, 'background: ' + color + ';' + style, ...args]);
	}
	// </remove>
}

const info = (...args) => {
	// <remove>
	args.unshift(`all#0652DD#Info`);
	log(...args);
	// </remove>
};

const warn = (...args) => {
	// <remove>
	args.unshift(`all#e67e22#Warn`);
	log(...args);
	// </remove>
};

const error = (...args) => {
	// <remove>
	args.unshift(`all#ED4C67#Error`);
	log(...args);
	// </remove>
};

const getLogger = (title = '-', color = '', user = 'all') => {
	return (...args) => {
		// <remove>
		if (user) {
			color = color.replace('#', '');
			args.unshift(`${user}#${color}#${title}`);
			log(...args);
		}
		// </remove>
	};
};

export { log, info, warn, error, getLogger };
